package com.czy.owner.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.czy.owner.R;
import com.czy.owner.entity.StoreMoreModel;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;

/**
 * Created by asus on 2017/5/18.
 */
public class StoreMoreAdapter extends RecyclerArrayAdapter<StoreMoreModel> {
    public StoreMoreAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new StoreMoreHolder(parent);
    }

    class StoreMoreHolder extends BaseViewHolder<StoreMoreModel> {
        private ImageView ivServiceImg;
        private TextView tvServiceName;

        public StoreMoreHolder(ViewGroup parent) {
            super(parent, R.layout.item_store_more_recycler);
            ivServiceImg = $(R.id.iv_service_img);
            tvServiceName = $(R.id.tv_service_name);
        }

        @Override
        public void setData(StoreMoreModel model) {
            super.setData(model);
            ivServiceImg.setImageResource(model.getImg());
            tvServiceName.setText(model.getName());
        }
    }

}
